import { defineConfig } from 'vite'
import dtsPlugin from "vite-plugin-dts";


export default defineConfig({
  plugins: [dtsPlugin()],
  build: {
    lib: {
      entry: './lib/main.ts',
      name: 'DistZip',
      fileName: 'distZip'
    },
    rollupOptions: {
      // 确保外部化处理那些你不想打包进库的依赖
      external: ["dayjs", "open", 'archiver', "node:fs", "node:path", "node:child_process"],
      output: {
        // // // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
        globals: {
          "archiver": "archiver",
          "dayjs": "dayjs",
          "open": "open",
          "node:child_process": "node:child_process1",
          "node:fs": "node:fs1",
          "node:path": "node:path1"
        }
      },
    },
  }
})
